package com.zephyr.vchcenter.test;

import java.util.Vector;

import com.zephyr.vchcenter.service.thread.ThreadManager;
import com.zephyr.vchcenter.service.thread.ThreadPoolManager;

public class InsertData implements Runnable{

	private int datasize;
	private String poolname;

	public InsertData(){
		this.datasize = 10;
		this.poolname = "default";
	}
	
	public InsertData(int datasize,String poolname){
		if (datasize <= 0) this.datasize = 10;
		else this.datasize = datasize;
		if (poolname == null || poolname == "") this.poolname = "default";
		else this.poolname = poolname;
	}
	
	public void run() {
		ThreadPoolManager tpm = ThreadPoolManager.getInstance();
		ThreadManager tm = tpm.getThreadManager(poolname);
		Vector data = new Vector();
		for (int i = 0; i < datasize; i++)
			data.add(poolname+" data insert: " + i);
		tm.setData(data);
	}

}
